package cn.edu.fzu.delivery.handler;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.google.common.collect.ImmutableList;

/**
 * @author fangxin
 * @date 2022年11月9日
 */
@Configuration
public class HandlerConfig {

    private final List<DeliveryHandler> deliveryHandlers;

    @Autowired
    public HandlerConfig(DeliveryHandler courierAllotHandler, DeliveryHandler courierPoolBuildHandler,
                         DeliveryHandler courierFilterHandler) {

        //快递员分配处理器
        this.deliveryHandlers = ImmutableList.of(
                //快递员池子构建
                courierPoolBuildHandler,
                //快递员过滤
                courierFilterHandler,
                //快递员分配
                courierAllotHandler);

    }


    @Bean("deliveryHandlers")
    public List<DeliveryHandler> deliveryHandlers() {
        return deliveryHandlers;
    }

}
